package com.kangyi.admin.mapper;

import com.github.pagehelper.Page;
import com.kangyi.admin.annotation.AutoFill;
import com.kangyi.dto.FeedbackPageQueryDTO;
import com.kangyi.dto.ReplyFeedbackDTO;
import com.kangyi.entity.UserComplaint;
import com.kangyi.enumeration.OperationType;
import com.kangyi.vo.FeedbackDetailVO;
import com.kangyi.vo.FeedbackPageQueryVO;
import com.kangyi.vo.UserComplaintImgVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Blank
 * @version 1.0
 */
@Mapper
public interface FeedbackMapper {
    Page<FeedbackPageQueryVO> pageQuery(FeedbackPageQueryDTO feedbackPageQueryDTO);

    void deleteFeedback(List<Integer> ids);

    void deleteFeedbackImages(List<Integer> ids);

    @Select("select * from user_complaint where id = #{feedbackId};")
    FeedbackDetailVO detailFeedback(Integer feedbackId);

    @Select("select * from user_complaint_img where user_complaint_id = #{feedbackId};")
    List<UserComplaintImgVO> getByFeedbackId(Integer feedbackId);

    @Update("update user_complaint set reply = #{reply}, status = #{status}, reply_time = #{replyTime}, update_time = #{updateTime}, update_user = #{updateUser} where id = #{id};")
    @AutoFill(value = OperationType.UPDATE)
    void replyFeedback(UserComplaint build);

}
